package kr.jobtc.phonebook;

import android.os.Bundle;
import android.app.Activity;
import android.database.sqlite.SQLiteDatabase;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;

public class InputActivity extends Activity {
	MyHelper helper;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_input);
		
		helper = new MyHelper(this);
	}

	public void input(View v){
		EditText name = (EditText)findViewById(R.id.name);
		EditText phone = (EditText)findViewById(R.id.phone);
		Data d = new Data();
		d.setName(name.getText().toString());
		d.setPhone(phone.getText().toString());
		
		helper.insert(d);
		name.setText("");
		phone.setText("");
		name.requestFocus();
	}
	
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		new OptionMenu(this, item);
		return super.onOptionsItemSelected(item);
	}

}
